######################################################## 
## ~W:	Forum Icon with ACP Control - List Box Option Qת ϥ (M)
## ~@:	ycl6 < ycl6@users.sourceforge.net > (Y.C. LIN) http://macphpbbmod.sourceforge.net/
##
## ~yz:	oӥ~iH޲zbxwUӰQתϥ
##		Mܦb indexBviewforum M viewtopic
## ~:	1.0.9
## 
## w:	
## wˮɶ:	10 
##
## ݭns誺ɮ:	12
##	index.php
##	viewforum.php
##	viewtopic.php
##	admin/admin_board.php
##	admin/admin_forums.php
##	language/lang_chinese_traditional_taiwan/lang_admin.php
##	templates/subSilver/admin/forum_admin_body.tpl
##	templates/subSilver/admin/board_config_body.tpl
##	templates/subSilver/admin/forum_edit_body.tpl
##	templates/subSilver/index_body.tpl
##	templates/subSilver/viewforum_body.tpl
##	templates/subSilver/viewtopic_body.tpl
##
## [ɮ: 		n/a
##
################################################################# 
## ѩwWҶqAˬd: 
## http://www.phpbb.com/mods/downloads/ O_~̷s 
## qLaUɥi|yAbA phpBB QתWgJ~{X 
## oӲzѡAphpBB N|Sæbڭ̪~Ʈw~Ѥ䴩 
## ڭ̪~Ʈwb http://www.phpbb.com/mods/downloads/
## 
## vn: o@ӥ~iHZnbΥ[JDx誺 phpBB 
############################################################## 
## @̯d:
##	b 2.0.14 աAib 2.0.6+ Wϥ
##
##	pGAQgJ (w]覡) Ϥ覡,
##	Aϥ Forum_Icon_tw.txt w˫. 
##	ФŨϥΥHUw˫! Au䤤@تϤ覡.
## 
############################################################## 
## v: 
##
##   2003-11-04 -  1.0.0
##      - oG
##
##   2003-11-08 -  1.0.1
##      - TwiHb 2.0.6 WϥΡA{XSܰ
##
##   2003-11-15 -  1.0.2
##      - w˫ܸgLקHŦX phpBB MOD Database nD
##
##   2003-12-01 -  1.0.3
##      - ϥܥiHβM (Ϥ覡 2)
##	- b޲zDiHܪϥ
##	- b viewforum.php iHܪϥ
##
##   2004-02-11 -  1.0.4
##      - ץϥܤeN]{HĤ@ιϥ
##		ϥιw]Ϥ覡B̤ͭݭns
##
##   2004-03-13 -  1.0.5
##      - ץϥܤeN]{HĤ@إߪ
##		ϥιw]Ϥ覡B̤ͭݭns
##
##   2004-05-29 -  1.0.6
##      - w˫ܸgLקHŦX phpBB MOD Database nD
##
##   2004-08-15 -  1.0.7
##	- b viewtopic.php iHܪϥ
##
##   2005-05-03 -  1.0.8
##	- ץϥܦbs誩ɦ^йw]ﶵ ( obiku ^)
##	- * w]Ϥ覡åss *
##
##   2005-05-09 -  1.0.9
##	- ץ $forum_icons_list ̪@Ӥp~
##	- * w]Ϥ覡åss *
## 
############################################################## 
## bW[~e, аȥƥҦݭnק諸ɮ
##############################################################
# 
#-----[ SQL ]------------------------------------------ 
#
# Remember to change the table prefix used on your database
ALTER TABLE `phpbb_forums` ADD `forum_icon` VARCHAR( 255 ) default NULL;
INSERT INTO `phpbb_config` VALUES ('forum_icon_path', '');

# 
#-----[ } ]------------------------------------------ 
# 
language/lang_chinese_traditional_taiwan/lang_admin.php

# 
#-----[ M ]------------------------------------------ 
#
$lang['Forum_status'] = 'A';

# 
#-----[ , [W ]------------------------------------------ 
#
$lang['Forum_icon'] = 'Ϲϥ'; // Forum Icon MOD
$lang['Forum_icon_path'] = 'Ϲϥxs|'; // Forum Icon MOD
$lang['Forum_icon_path_explain'] = 'bz phpBB 2 ڥؿU|, Ҧp: images/forum_icons'; // Forum Icon MOD

# 
#-----[ } ]------------------------------------------ 
# 
admin/admin_board.php

# 
#-----[ M ]------------------------------------------ 
#
	"L_AVATAR_GALLERY_PATH_EXPLAIN" => $lang['Avatar_gallery_path_explain'],

# 
#-----[ , [W ]------------------------------------------ 
#
	"L_FORUM_ICON_PATH" => $lang['Forum_icon_path'], // Forum Icon MOD
	"L_FORUM_ICON_PATH_EXPLAIN" => $lang['Forum_icon_path_explain'], // Forum Icon MOD

# 
#-----[ M ]------------------------------------------ 
#
	"AVATAR_GALLERY_PATH" => $new['avatar_gallery_path'],

# 
#-----[ , [W ]------------------------------------------ 
#
	"FORUM_ICON_PATH" => $new['forum_icon_path'], // Forum Icon MOD

# 
#-----[ } ]------------------------------------------ 
#  
admin/admin_forums.php

# 
#-----[ M ]------------------------------------------ 
# 
			if ($mode == 'editforum')
			{
				// $newmode determines if we are going to INSERT or UPDATE after posting?


# 
#-----[ e, [W ]------------------------------------------ 
# 
			// Forum Icon MOD
			$dir = @opendir($phpbb_root_path . $board_config['forum_icon_path']);
			$count = 0;
			while( $file = @readdir($dir) )
			{
				if( !@is_dir(phpbb_realpath($phpbb_root_path . $board_config['forum_icon_path'] . '/' . $file)) )
				{
					if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $file) )
					{
						$forum_icons[$count] = $file; 
						$count++;
					}
				}
			}

			@closedir($dir);
				
			if ($mode == 'addforum')
			{
				$forum_icons_list = "";
				$forum_icons_list .= '<option value="' . $forum_icons[0] . '" selected="selected">' . $forum_icons[0] . '</option>'; 
				
				for( $i = 1; $i < count($forum_icons); $i++ )
				{
					$forum_icons_list .= '<option value="' . $forum_icons[$i] . '">' . $forum_icons[$i] . '</option>';
					$default_ficon = $forum_icons[0];
				}
			}
# 
#-----[ M ]------------------------------------------ 
# 
				$forumstatus = $row['forum_status'];

# 
#-----[ , [W ]------------------------------------------ 
# 
				$forumicon = $row['forum_icon']; // Forum Icon MOD

				// Forum Icon MOD - New fix for 1.0.8
				$forum_icons_list = "";
				for( $i = 0; $i < count($forum_icons); $i++ )
				{
					if ($forum_icons[$i] == $row['forum_icon'])
					{
						$forum_icons_list .= '<option value="' . $forum_icons[$i] . '" selected="selected">' . $forum_icons[$i] . '</option>';
					}
					else
					{
						$forum_icons_list .= '<option value="' . $forum_icons[$i] . '">' . $forum_icons[$i] . '</option>';
					}
					$default_ficon = $forum_icons[0];
				}

# 
#-----[ M ]------------------------------------------ 
# 
				$forumstatus = FORUM_UNLOCKED;

# 
#-----[ , [W ]------------------------------------------ 
# 
				$forumicon = ''; // Forum Icon MOD

# 
#-----[ M ]------------------------------------------ 
# 
				'L_FORUM_STATUS' => $lang['Forum_status'],

# 
#-----[ , [W ]------------------------------------------ 
# 
				'L_FORUM_ICON' => $lang['Forum_icon'], // Forum Icon MOD

# 
#-----[ M ]------------------------------------------ 
#
				'DESCRIPTION' => $forumdesc)

# 
#-----[ N ]------------------------------------------ 
#
				'DESCRIPTION' => $forumdesc, 
				'ICON_LIST' => $forum_icons_list, // Forum Icon MOD
				'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'], // Forum Icon MOD
				'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon // Forum Icon MOD
				)

# 
#-----[ M ]------------------------------------------ 
#
			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")

# 
#-----[ , M ]------------------------------------------ 
#
forum_status

# 
#-----[ , [W ]------------------------------------------ 
#
, forum_icon

# 
#-----[ M ]------------------------------------------ 
#
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

# 
#-----[ , M ]------------------------------------------ 
#
, " . intval($HTTP_POST_VARS['forumstatus']) . "

# 
#-----[ , [W ]------------------------------------------ 
#
, '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "'

# 
#-----[ M ]------------------------------------------ 
#
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
# 
#-----[ , M ]------------------------------------------ 
#
, forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . "

# 
#-----[ , [W ]------------------------------------------ 
#
, forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "'

# 
#-----[ M ]------------------------------------------ 
# 
					'FORUM_DESC' => $forum_rows[$j]['forum_desc'],

# 
#-----[ , [W ]------------------------------------------ 
# 
					'FORUM_ICON_IMG' => ( $forum_rows[$j]['forum_icon'] ) ? '<img src="' . $phpbb_root_path . $board_config['forum_icon_path'] .'/' . $forum_rows[$j]['forum_icon'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '', // Forum Icon Mod

# 
#-----[ } ]------------------------------------------ 
#  
index.php

# 
#-----[ M ]------------------------------------------ 
# 
							$posts = $forum_data[$j]['forum_posts'];
							$topics = $forum_data[$j]['forum_topics'];

# 
#-----[ , [W ]------------------------------------------ 
# 
							$icon = $forum_data[$j]['forum_icon'];	// Forum Icon Mod

# 
#-----[ M ]------------------------------------------ 
# 
								'FORUM_FOLDER_IMG' => $folder_image, 

# 
#-----[ , [W ]------------------------------------------ 
# 
								'FORUM_ICON_IMG' => ($icon) ? '<img src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $icon . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',	// Forum Icon Mod

# 
#-----[ } ]------------------------------------------ 
#  
viewforum.php

# 
#-----[ M ]------------------------------------------ 
# 
	'FORUM_NAME' => $forum_row['forum_name'],

# 
#-----[ , [W ]------------------------------------------ 
# 
	'FORUM_ICON_IMG' => ($forum_row['forum_icon']) ? '<img src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_row['forum_icon'] . '" alt="'.$forum_row['forum_name'].'" title="'.$forum_row['forum_name'].'" />&nbsp;' : '', // Forum Icon Mod

# 
#-----[ } ]------------------------------------------ 
#  
viewtopic.php

# 
#-----[ M ]------------------------------------------ 
# 
//
// End auth check
//

# 
#-----[ , [W ]------------------------------------------ 
# 
// Forum Icon Mod
$sql = "SELECT forum_icon
	FROM " . FORUMS_TABLE . "
	WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$forum_row = $db->sql_fetchrow($result);
$forum_icon = $forum_row['forum_icon'];

# 
#-----[ M ]------------------------------------------ 
# 
	'FORUM_NAME' => $forum_name,

# 
#-----[ , [W ]------------------------------------------ 
# 
	'FORUM_ICON_IMG' => ($forum_icon) ? '<img src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_icon . '" alt="'.$forum_name.'" title="'.$forum_name.'" />&nbsp;' : '',	// Forum Icon Mod

# 
#-----[ } ]------------------------------------------ 
#  
templates/subSilver/admin/board_config_body.tpl

# 
#-----[ M ]------------------------------------------ 
# 
	<tr>
		<td class="row1">{L_SYSTEM_TIMEZONE}</td>
		<td class="row2">{TIMEZONE_SELECT}</td>
	</tr>

# 
#-----[ , [W ]------------------------------------------ 
# 
	<tr>
		<td class="row1">{L_FORUM_ICON_PATH} <br /><span class="gensmall">{L_FORUM_ICON_PATH_EXPLAIN}</span></td>
		<td class="row2"><input class="post" type="text" size="20" maxlength="255" name="forum_icon_path" value="{FORUM_ICON_PATH}" /></td>
	</tr>

# 
#-----[ } ]------------------------------------------ 
#  
templates/subSilver/admin/forum_edit_body.tpl

# 
#-----[ M ]------------------------------------------ 
# 
<p>{L_FORUM_EXPLAIN}</p>

# 
#-----[ , [W ]------------------------------------------ 
# 
<script language="javascript" type="text/javascript">
<!--
function update_forum_icon(newimage)
{
	document.forum_icon.src = "{ICON_BASEDIR}/" + newimage;
}
//-->
</script>

# 
#-----[ M ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1">{L_FORUM_NAME}</td> 
	  <td class="row2"><input type="text" size="25" name="forumname" value="{FORUM_NAME}" class="post" /></td> 
	</tr> 

# 
#-----[ , [W ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1">{L_FORUM_ICON}</td>
	  <td class="row2"><select name="forumicon" onchange="update_forum_icon(this.options[selectedIndex].value);">{ICON_LIST}</select> &nbsp; <img name="forum_icon" src="{ICON_IMG}" border="0" alt="" /> &nbsp;</td>
	</tr>

# 
#-----[ } ]------------------------------------------ 
#  
templates/subSilver/admin/forum_admin_body.tpl

# 
#-----[ M ]------------------------------------------ 
# 
		<td class="row2"><span class="gen"><a href="{catrow.forumrow.U_VIEWFORUM}" target="_new">{catrow.forumrow.FORUM_NAME}</a></span><br /><span class="gensmall">{catrow.forumrow.FORUM_DESC}</span></td>

# 
#-----[ , M ]------------------------------------------ 
#
		<td class="row2"><span class="gen">

# 
#-----[ , [W ]------------------------------------------ 
# 
{catrow.forumrow.FORUM_ICON_IMG}&nbsp;&nbsp;

# 
#-----[ } ]------------------------------------------ 
# 
templates/subSilver/index_body.tpl

# 
#-----[ M ]------------------------------------------ 
# 
	<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>

# 
#-----[ , M ]------------------------------------------ 
#
colspan="2"

# 
#-----[ N ]------------------------------------------ 
# 
colspan="3"

# 
#-----[ M ]------------------------------------------ 
#
	<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>

# 
#-----[ , M ]------------------------------------------ 
#
colspan="2"

# 
#-----[ N ]------------------------------------------ 
#
colspan="3"

# 
#-----[ M ]------------------------------------------ 
#
	<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>

# 
#-----[ , [W ]------------------------------------------ 
#
	<td class="row1" align="center" valign="middle" height="50">{catrow.forumrow.FORUM_ICON_IMG}</td>

# 
#-----[ } ]------------------------------------------ 
# 
templates/subSilver/viewforum_body.tpl

# 
#-----[ M ]------------------------------------------ 
# 
	  <td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a>

# 
#-----[ , M ]------------------------------------------ 
#
	  <td align="left" valign="bottom" colspan="2">

# 
#-----[ , [W ]------------------------------------------ 
# 
{FORUM_ICON_IMG}

# 
#-----[ } ]------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl

# 
#-----[ M ]------------------------------------------ 
# 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>

# 
#-----[ , M ]------------------------------------------ 
#
<a href="{U_VIEW_FORUM}" class="nav">

# 
#-----[ e, [W ]------------------------------------------ 
# 
{FORUM_ICON_IMG}

# 
#-----[ xs/Ҧɮ ]------------------------------------------ 
# 
# ~ץ
